package com.itheima.health.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: liangWeiQUQ
 * @Description: Controller的方法上加入注解进行权限控制,对方法进行权限控制
 * @DateTime: 2021/3/6 19:59
 **/
@RestController
@RequestMapping("/test")
public class TestSecurityController {

    @GetMapping("/addData")
    @PreAuthorize("hasAuthority('add')")
    public String addData(){
        return "addData ok";
    }

    @GetMapping("/updateData")
    @PreAuthorize("hasAuthority('update')")
    public String updateData(){
        return "updateData ok";
    }


    @GetMapping("/delData")
    @PreAuthorize("hasAuthority('delete')")
    public String delData(){
        return "delData ok";
    }


    @GetMapping("/findData")
    @PreAuthorize("hasAuthority('find')")
    public String findAll(){
        return "findData ok";
    }
}
